import java.io.*;

public class Demo1 {
    public static void main(String[] args) {
     //   try(Writer writer = new FileWriter("test2.txt")){
        try(OutputStream outputStream = new FileOutputStream("test2.txt")){
            PrintWriter printWriter = new PrintWriter(outputStream);
            printWriter.println("hello");
        //    String s = "hello java";
           // outputStream.write(s.getBytes());
         //   writer.write("hello world");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}

